{% extends 'generic/object.html' %}
{% load static %}
{% load helpers %}
{% load plugins %}

{% block breadcrumbs %}
  <li><a href="{% url 'circuits:provider_list' %}">Providers</a></li>
  <li>{{ object }}</li>
{% endblock %}

{% block content %}
<div class="row">
	  <div class="col-md-6">
        <div class="panel panel-default">
            <div class="panel-heading">
                <strong>Provider</strong>
            </div>
            <table class="table table-hover panel-body attr-table">
                <tr>
                    <td>ASN</td>
                    <td>{{ object.asn|placeholder }}</td>
                </tr>
                <tr>
                    <td>Account</td>
                    <td>{{ object.account|placeholder }}</td>
                </tr>
                <tr>
                    <td>Customer Portal</td>
                    <td>
                        {% if object.portal_url %}
                            <a href="{{ object.portal_url }}">{{ object.portal_url }}</a>
                        {% else %}
                            <span class="text-muted">&mdash;</span>
                        {% endif %}
                    </td>
                </tr>
                <tr>
                    <td>NOC Contact</td>
                    <td class="rendered-markdown">{{ object.noc_contact|render_markdown|placeholder }}</td>
                </tr>
                <tr>
                    <td>Admin Contact</td>
                    <td class="rendered-markdown">{{ object.admin_contact|render_markdown|placeholder }}</td>
                </tr>
                <tr>
                    <td>Circuits</td>
                    <td>
                        <a href="{% url 'circuits:circuit_list' %}?provider_id={{ object.pk }}">{{ circuits_table.rows|length }}</a>
                    </td>
                </tr>
            </table>
        </div>
        {% plugin_left_page object %}
    </div>
    <div class="col-md-6">
        {% include 'inc/custom_fields_panel.html' %}
        {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='circuits:provider_list' %}
        <div class="panel panel-default">
            <div class="panel-heading">
                <strong>Comments</strong>
            </div>
            <div class="panel-body rendered-markdown">
                {% if object.comments %}
                    {{ object.comments|render_markdown }}
                {% else %}
                    <span class="text-muted">None</span>
                {% endif %}
            </div>
        </div>
        {% plugin_right_page object %}
    </div>
</div>
<div class="row">
    <div class="col-md-12">
        <div class="panel panel-default">
            <div class="panel-heading">
                <strong>Circuits</strong>
            </div>
            {% include 'inc/table.html' with table=circuits_table %}
            {% if perms.circuits.add_circuit %}
                <div class="panel-footer text-right noprint">
                    <a href="{% url 'circuits:circuit_add' %}?provider={{ object.pk }}" class="btn btn-xs btn-primary">
                        <span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add circuit
                    </a>
                </div>
            {% endif %}
        </div>
        {% include 'inc/paginator.html' with paginator=circuits_table.paginator page=circuits_table.page %}
    </div>
</div>
<div class="row">
    <div class="col-md-12">
        {% plugin_full_width_page object %}
    </div>
</div>
{% endblock %}
